home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_c
/
cgraphix
/
drawstra.c
< prev
next >
Wrap
Text File
|
1986-05-12
|
917b
|
43 lines
/* «RM120»«PL99999»«TS4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76» */
#include <stdio.h>
#define EXTERN extern
#include <typedef.h>
void DrawStraight(x1,x2,y) /* Draw a horizontal line from x1,y to x2,y */
int x1, x2, y;
{
int i, x, DirectModeLoc;
if (!((x1 < 0) || (x1 > 8 * XMaxGlb + 7)) &&
!((x2 < 0) || (x2 > 8 * XMaxGlb + 7)) &&
((y >= 0) && (y <= YMaxGlb))) {
DirectModeLoc = DirectModeGlb;
DirectModeGlb = TRUE;
if (x1 > x2) {
x = x1;
x1 = x2;
x2 = x;
}
if (x2 - x1 < 16) {
for (x = x1; x <= x2; x++) {
DP(x,y);
}
}
else {
x1 += 8;
for (i = (x1-8); i <= (x1 & -8); i++) {
DP(i,y);
}
for (i = (x2 & -8); i <= x2; i++) {
DP(i,y);
}
filblock(BaseAddress(y) + (x1 >> 3), GrafBase,
ColorGlb, (x2 >> 3)-(x1 >> 3));
}
DirectModeGlb = DirectModeLoc;
}
}